import { onMounted, onUnmounted, reactive } from "vue";

export default function(){
   let point = reactive({
    pointX:0,
    pointY:0
   }) 
   let savePoint = (e)=>{
    const {x,y} = e
    point.pointX = x
    point.pointY = y
   }
   onMounted(()=>{
    window.addEventListener('click',savePoint)
    console.log('我是hooks')
   })
   onUnmounted(()=>{
    window.removeEventListener('click',savePoint)
   })

   return point
}